package cn.wolfcode.rbac.domain;

import com.alibaba.fastjson.JSON;
import lombok.Data;

import java.util.Date;
import java.util.HashMap;

@Data
public class Customer {
    private Long id;
    private String name;
    private Integer age;
    private Integer gender;
    private String tel;
    private String qq;
    private SystemDictionaryItem job;
    private SystemDictionaryItem source;
    private Employee seller;
    private Integer status;
    private Date input_time;
    //获取页面中的data-json属性
    public String getJson(){
        HashMap<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("age",age);
        map.put("tel",tel);
        map.put("gender",gender);
        map.put("qq",qq);
        map.put("job",job);
        map.put("source",source);
        map.put("seller",seller);
        map.put("status",status);
        return JSON.toJSONString(map);
    }
    public String getDisplayGender(){
        if(gender != null){
            if(this.gender == 0){
                return "男";
            }else {
                return "女";
            }
        }else{
            return "";
        }

    }

    public String getDisplayStatus() {
        if(status != null){
            if (status == 0) {
                //0表示潜在客户
                return "潜在客户";
            } else if (status == 1) {
                //1表示正式客户
                return "正式客户";
            } else if (status == 2) {
                //2表示资源池客户
                return "资源池客户";
            } else if (status == 3) {
                //3表示失败客户
                return "失败客户";
            } else if (status == 4) {
                //4表示流失客户
                return "流失客户";
            } else if (status == 11) {
                //11表示跟进历史
                return "跟进历史";
            } else {
                //22表移交历史
                return "移交历史";
            }
        }else{
            return "";
        }

    }
}
